package com.bjqh.edu.UI.dialog;

import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.bjqh.edu.R;

/**
 * Created by Administrator on 2017/11/7 0007.
 */

public class ConfirmDialog extends Dialog {

    private TextView title;
    private TextView content;
    private String tValue;
    private String cValue;
    public Button confirm;
    private boolean cancelable = true;

    public ConfirmDialog(@NonNull Context context, String title, String content,Boolean cancelable) {
        super(context, R.style.WhiteDialog);
        this.tValue = title;
        this.cValue = content;
        if(null!=cancelable)
        this.cancelable=cancelable;
        this.show();
    }

    public ConfirmDialog(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.confirm_dialog);
        title = (TextView) findViewById(R.id.title);
        content = (TextView) findViewById(R.id.content);
        confirm = (Button) findViewById(R.id.confirm);
        title.setText(tValue);
        content.setText(cValue);
        confirm.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
        this.setCanceledOnTouchOutside(false);

    }


}
